home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b2.d64
/
addition
< prev
next >
Wrap
Text File
|
2007-02-28
|
793b
|
40 lines
0010 PRINT CHR$(147) //CLEAR SCREEN//
0020 //
0030 PRINT "HOW MANY EXERCISES",
0040 INPUT MAXNO
0050 FOR NO:=1 TO MAXNO DO
0060 A:=RND(1,5); B:=RND(1,5)
0070 RESULT:=A+B
0080 EXERCISE
0090 GETANSWER
0100 CONTROL
0110 ENDFOR NO
0120 //
0130 PROC EXERCISE
0140 FOR I:=1 TO 3 DO PRINT
0150 PRINT "----------------------------"
0160 PRINT "EXERCISE NO. ",NO
0170 PRINT
0180 ENDPROC EXERCISE
0190 //
0200 PROC GETANSWER
0210 C:=0
0220 REPEAT
0230 PRINT A," + ",B," = ",
0240 INPUT "": ANSWER
0250 C:=C+1
0260 PRINT
0270 UNTIL ANSWER=RESULT OR C=3
0280 ENDPROC GETANSWER
0290 //
0300 PROC CONTROL
0310 IF ANSWER=RESULT THEN
0320 PRINT "THAT'S CORRECT!"
0330 ELSE
0340 PRINT "YOUR ANSWER IS NOT CORRECT;"
0350 PRINT
0360 PRINT A," + ",B," = ",RESULT
0370 ENDIF
0380 ENDPROC CONTROL
0390 //